package com.module.msg.model

import cn.leancloud.LCObject
import cn.leancloud.LCQuery
import com.module.app.base.BaseViewModel
import com.module.app.bean.ListViewBean
import com.module.base.ext.request
import com.module.frame.ext.postEvent
import com.module.msg.bean.MsgBean
import com.module.third.learcloud.lcQuery

class HotMsgViewModel : BaseViewModel() {

    fun getData() {
        request({
            val tClass = MsgBean::class.java
            val query = LCQuery<LCObject>(tClass.simpleName)
            query.whereEqualTo("isHot", true)
            lcQuery(query, tClass)
        }, {
            postEvent(listFlow, ListViewBean(true, it, true))
        }, {
            postEvent(errorFlow, it)
        })
    }

}